# $Id: PKGBUILD 90140 2013-05-07 06:36:32Z faidoc $
# Maintainer: Alexandre Filgueira <alexfilgueira@cinnarch.com>
# Contributor: M0Rf30
# Contributor: unifiedlinux
# Contributor: CReimer

pkgname=cinnamon
pkgver=1.8.1
pkgrel=1
pkgdesc="Linux desktop which provides advanced innovative features and a traditional user experience"
arch=('i686' 'x86_64')
url="http://cinnamon.linuxmint.com/"
license=('GPL2')
depends=('accountsservice' 'caribou' 'clutter-gtk' 'gjs' 'gnome-bluetooth'
         'gnome-icon-theme' 'gnome-menus' 'gnome-settings-daemon' 'gnome-session'
         'gnome-themes-standard' 'gstreamer0.10' 'libgnome-keyring' 'librsvg'
         'networkmanager' 'muffin' 'pygtk' 'python2-dbus' 'python2-imaging'
         'python2-pyinotify' 'python2-lxml' 'webkitgtk3' 'gnome-settings-daemon-compat')
makedepends=('gnome-common' 'intltool')
optdepends=('cinnamon-control-center: extended configurations for Cinnamon'
            'cinnamon-screensaver: lock screen'
            'gucharmap: show character table from Keyboard applet'
            'libgnomekbd: show keyboard layout from Keyboard applet'
            'nemo: the official Cinnamon file manager (forked from Nautilus)')
options=('!libtool' '!emptydirs')
install=${pkgname}.install
source=("$pkgname-$pkgver.tar.gz::https://github.com/linuxmint/Cinnamon/tarball/$pkgver"
        "keyboard_applet.patch"
        "fix-control-center-check.patch"
        "gnome-3.8.patch"
        "switch-applications.patch"
        "fallback-helpers.patch"
        "idle-dim.patch")
sha256sums=('c7ef75572d4967265a16102e7fa0734db35c33ee792c01dcb9eff7e43e711530'
            'a0c05c995102b16f1060cbd43931eeaefeafd0265a0335e4ca14a143bd4c8c30'
            'ee5694bdc997ffa35a817f691b15bae13747137d35ec2aecd0da298d7edbe426'
            '0971ac14bc31167d3b94ea93e608c5d49518a12b89f40c97f84d80e715657aa3'
            '921a1f63d2890dd54c149aa27a3d3209ac2fb843be597ae4ef3b4621e76a2262'
            'fc8e8f5b7772ff331212280b0d4cf624c5ca2a442e8e8defc319cc2f2b060f2e'
            'b34c30299fb88228c59f36fced90d56346847019a080bc7b8157b72caa659100')

build() {
  cd ${srcdir}/linuxmint-Cinnamon*

  # Python2 fix
  sed -i 's|#! /usr/bin/python|#! /usr/bin/python2|' \
    files/usr/bin/$pkgname-menu-editor \
    files/usr/share/$pkgname/applets/panel-launchers@$pkgname.org/$pkgname-add-panel-launcher.py
  find -type f | xargs sed -i 's@^#!.*python$@#!/usr/bin/python2@'

  # Fix Keyboard applet
  # https://github.com/linuxmint/Cinnamon/issues/1337
  patch -Np1 -i ../keyboard_applet.patch

  # Check for the cc-panel path, not for the unneeded binary
  patch -Np1 -i ../fix-control-center-check.patch

  # https://github.com/linuxmint/Cinnamon/pull/1888
  patch -Np1 -i ../gnome-3.8.patch

  # Fix windows switcher keybinding with default settings in GNOME 3.8
  patch -Np1 -i ../switch-applications.patch

  # Start media keys and mount helpers with the session
  patch -Np1 -i ../fallback-helpers.patch

  # Fix brightness applet for GNOME 3.8
  patch -Np1 -i ../idle-dim.patch

  ./autogen.sh --prefix=/usr \
               --sysconfdir=/etc \
               --libexecdir=/usr/lib/cinnamon \
               --localstatedir=/var \
               --disable-static \
               --disable-schemas-compile \
               --enable-compile-warnings=yes \
               --with-session-tracking=systemd
  make
}

package() {
  cd ${srcdir}/linuxmint-Cinnamon*
  make DESTDIR="${pkgdir}" install
}
